package com.baizan.daka.ui.activity

import android.content.Intent
import com.baizan.base.BaseActivity
import com.baizan.daka.Constants
import com.baizan.daka.base.BasePresenter
import com.baizan.daka.startActivity
import com.baizan.daka.util.Preference
import com.dianzan.daka.R
import kotlinx.android.synthetic.main.act_ad.*

class AdActivity : BaseActivity<BasePresenter>() {

    override fun initPresenter(): BasePresenter? = null

    override fun layoutId(): Int {
        return R.layout.act_ad
    }

    override fun initData() {

    }

    override fun initView() {
        if (!this.isTaskRoot) {
            val intent = intent
            if (intent != null) {
                val action = intent.action
                if (intent.hasCategory(Intent.CATEGORY_LAUNCHER) && Intent.ACTION_MAIN == action) {
                    finish()
                    return
                }
            }
        }
        var isLogin: Boolean by Preference(Constants.ISLOGIN, false)
        if (isLogin) {
            image.postDelayed(Runnable {
                startActivity<HomeActivity>()
                finish()
            },1000)

        }else{
            image.postDelayed(Runnable {
                LoginActivity.start(this)
                finish()
            },1000)
        }

    }

    override fun start() {

    }




}